// ==================== 导入拆分后的API模块 ====================
// 为了保持向后兼容性，重新导出所有API函数

// 社团浏览相关API
import {
  listClub,
  getClub,
  getPopularClubs,
  listRecruitment,
  getRecruitment,
  submitApplication as clubBrowseSubmitApplication,
  addApplication as clubBrowseAddApplication,
  updateApplication as clubBrowseUpdateApplication
} from './student/clubBrowse.js'

// 我的申请相关API
import {
  getStudentApplications,
  listApplication,
  submitApplication as myApplicationsSubmitApplication,
  addApplication as myApplicationsAddApplication,
  updateApplication as myApplicationsUpdateApplication,
  withdrawApplication
} from './student/myApplications.js'

// 面试预约管理相关API
import {
  getStudentAppointments,
  listInterviewSlot,
  listInterviewAppointment,
  addInterviewAppointment,
  updateInterviewAppointment,
  bookInterview,
  cancelAppointment
} from './student/interviewManagement.js'

// 智能推荐相关API
import {
  getStudentMatches,
  listMatchingRecord,
  generateRecommendation,
  getStudentRecommendations
} from './student/smartRecommendations.js'

// 学生个人资料相关API
import {
  getStudent,
  updateStudent,
  updateStudentProfile,
  uploadStudentAvatar,
  getStudentPortalData,
  checkStudentEmail,
  checkStudentPhone,
  checkStudentNumber
} from './student/studentProfile.js'

// ==================== 保留原有管理功能API ====================
import request from '@/utils/request'

// ==================== 管理功能相关API (保留) ====================

// 查询学生列表
export function listStudent(query) {
  return request({
    url: '/campus/student/list',
    method: 'get',
    params: query
  })
}

// 新增学生
export function addStudent(data) {
  return request({
    url: '/campus/student',
    method: 'post',
    data: data
  })
}

// 删除学生
export function delStudent(studentId) {
  return request({
    url: '/campus/student/' + studentId,
    method: 'delete'
  })
}

// 批量删除学生
export function delStudents(studentIds) {
  return request({
    url: '/campus/student/' + studentIds,
    method: 'delete'
  })
}

// 导出学生数据
export function exportStudent(query) {
  return request({
    url: '/campus/student/export',
    method: 'get',
    params: query
  })
}

// 获取学生统计信息
export function getStudentStats() {
  return request({
    url: '/campus/student/stats',
    method: 'get'
  })
}

// 按学院统计学生
export function getStudentStatsByCollege() {
  return request({
    url: '/campus/student/stats/college',
    method: 'get'
  })
}

// 按年级统计学生
export function getStudentStatsByGrade() {
  return request({
    url: '/campus/student/stats/grade',
    method: 'get'
  })
}

// 按专业统计学生
export function getStudentStatsByMajor() {
  return request({
    url: '/campus/student/stats/major',
    method: 'get'
  })
}

// 重置学生密码
export function resetStudentPwd(studentId, password) {
  const data = {
    studentId,
    password
  }
  return request({
    url: '/campus/student/resetPwd',
    method: 'put',
    data: data
  })
}

// 修改学生状态
export function changeStudentStatus(studentId, status) {
  const data = {
    studentId,
    status
  }
  return request({
    url: '/campus/student/changeStatus',
    method: 'put',
    data: data
  })
}

// 批量导入学生
export function importStudent(data) {
  return request({
    url: '/campus/student/import',
    method: 'post',
    data: data
  })
}

// 下载学生导入模板
export function importStudentTemplate() {
  return request({
    url: '/campus/student/importTemplate',
    method: 'get'
  })
}

// ==================== 重新导出拆分后的API函数 (保持向后兼容性) ====================

// 学生个人资料相关
export {
  getStudent,
  updateStudent,
  updateStudentProfile,
  uploadStudentAvatar,
  getStudentPortalData,
  checkStudentEmail,
  checkStudentPhone,
  checkStudentNumber
}

// 社团浏览相关
export {
  listClub,
  getClub,
  getPopularClubs,
  listRecruitment,
  getRecruitment
}

// 申请管理相关
export {
  getStudentApplications,
  listApplication,
  withdrawApplication
}

// 统一申请提交函数 (优先使用myApplications模块的版本)
export { submitApplication as myApplicationsSubmitApplication, addApplication as myApplicationsAddApplication, updateApplication as myApplicationsUpdateApplication } from './student/myApplications.js'

// 为了保持完全兼容性，也导出默认的submitApplication
export const submitApplication = myApplicationsSubmitApplication
export const addApplication = myApplicationsAddApplication  
export const updateApplication = myApplicationsUpdateApplication

// 面试预约管理相关 (仅导出学生可用的API)
export {
  getStudentAppointments,
  bookInterview,
  cancelAppointment
}

// 智能推荐相关 (仅导出学生可用的API)
export {
  getStudentRecommendations,
  generateRecommendation
}